<template><div><h2 id="快捷创建" tabindex="-1"><a class="header-anchor" href="#快捷创建"><span>快捷创建</span></a></h2>
<p>Dcat Admin 中文文档 /</p>
<h2 id="快捷创建-1" tabindex="-1"><a class="header-anchor" href="#快捷创建-1"><span>快捷创建</span></a></h2>
<p>在表格中开启这个功能之后，会在表格头部增加一个<code v-pre>form</code>表单来创建数据，对于一些简单的表格页面，可以方便快速创建数据，不用跳转到创建页面操作<br>
<img src="https://cdn.learnku.com/uploads/images/202004/26/38389/sI5PPmhbqP.png!large" alt=""></p>
<h3 id="基本使用" tabindex="-1"><a class="header-anchor" href="#基本使用"><span>基本使用</span></a></h3>
<blockquote>
<p>需要注意的是，快捷创建表单中的每一项，在<code v-pre>form</code>表单页面要设置相同类型的表单项。</p>
</blockquote>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$grid</span><span class="token operator">-></span><span class="token function">quickCreate</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token class-name class-name-fully-qualified type-declaration">Grid<span class="token punctuation">\</span>Tools<span class="token punctuation">\</span>QuickCreate</span> <span class="token variable">$create</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line">    <span class="token variable">$create</span><span class="token operator">-></span><span class="token function">text</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'名称'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line">    <span class="token variable">$create</span><span class="token operator">-></span><span class="token function">email</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'email'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'邮箱'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="设置提交地址" tabindex="-1"><a class="header-anchor" href="#设置提交地址"><span>设置提交地址</span></a></h3>
<blockquote>
<p>Since <code v-pre>v1.4.0</code></p>
</blockquote>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$grid</span><span class="token operator">-></span><span class="token function">quickCreate</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token class-name class-name-fully-qualified type-declaration">Grid<span class="token punctuation">\</span>Tools<span class="token punctuation">\</span>QuickCreate</span> <span class="token variable">$create</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line">    <span class="token variable">$create</span><span class="token operator">-></span><span class="token function">action</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'auth/users'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line">    <span class="token variable">$create</span><span class="token operator">-></span><span class="token function">method</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'GET'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>表单支持的表单项有下面的几种类型</p>
<h3 id="文本-text" tabindex="-1"><a class="header-anchor" href="#文本-text"><span>文本(text)</span></a></h3>
<p>文本输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">text</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="隐藏表单-hidden" tabindex="-1"><a class="header-anchor" href="#隐藏表单-hidden"><span>隐藏表单(hidden)</span></a></h3>
<p>文本输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">hidden</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="邮箱-email" tabindex="-1"><a class="header-anchor" href="#邮箱-email"><span>邮箱(email)</span></a></h3>
<p>邮箱输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">email</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="ip输入框" tabindex="-1"><a class="header-anchor" href="#ip输入框"><span>IP输入框</span></a></h3>
<p>ip地址输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">ip</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="url输入框" tabindex="-1"><a class="header-anchor" href="#url输入框"><span>URL输入框</span></a></h3>
<p>url输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">url</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="密码-password" tabindex="-1"><a class="header-anchor" href="#密码-password"><span>密码(password)</span></a></h3>
<p>密码输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">password</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="手机号-mobile" tabindex="-1"><a class="header-anchor" href="#手机号-mobile"><span>手机号(mobile)</span></a></h3>
<p>手机号输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">mobile</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="整数-integer" tabindex="-1"><a class="header-anchor" href="#整数-integer"><span>整数(integer)</span></a></h3>
<p>整形数字输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">integer</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="下拉选框-select" tabindex="-1"><a class="header-anchor" href="#下拉选框-select"><span>下拉选框(select)</span></a></h3>
<p>单选框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">select</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token operator">-></span><span class="token function">options</span><span class="token punctuation">(</span><span class="token punctuation">[</span></span>
<span class="line">    <span class="token number">1</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'foo'</span><span class="token punctuation">,</span></span>
<span class="line">    <span class="token number">2</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'bar'</span><span class="token punctuation">,</span></span>
<span class="line"><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="下拉选框多选-multipleselect" tabindex="-1"><a class="header-anchor" href="#下拉选框多选-multipleselect"><span>下拉选框多选(multipleSelect)</span></a></h3>
<p>多选框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">multipleSelect</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token operator">-></span><span class="token function">options</span><span class="token punctuation">(</span><span class="token punctuation">[</span></span>
<span class="line">    <span class="token number">1</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'foo'</span><span class="token punctuation">,</span></span>
<span class="line">    <span class="token number">2</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'bar'</span><span class="token punctuation">,</span></span>
<span class="line"><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="标签-tags" tabindex="-1"><a class="header-anchor" href="#标签-tags"><span>标签(tags)</span></a></h3>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">tags</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token operator">-></span><span class="token function">options</span><span class="token punctuation">(</span><span class="token punctuation">[</span></span>
<span class="line">    <span class="token number">1</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'foo'</span><span class="token punctuation">,</span></span>
<span class="line">    <span class="token number">2</span> <span class="token operator">=></span> <span class="token string single-quoted-string">'bar'</span><span class="token punctuation">,</span></span>
<span class="line"><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="日期时间选择" tabindex="-1"><a class="header-anchor" href="#日期时间选择"><span>日期时间选择</span></a></h3>
<p>时间日期输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">datetime</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="时间选择-time" tabindex="-1"><a class="header-anchor" href="#时间选择-time"><span>时间选择(time)</span></a></h3>
<p>时间输入框</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">time</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="日期选择" tabindex="-1"><a class="header-anchor" href="#日期选择"><span>日期选择</span></a></h3>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token variable">$create</span><span class="token operator">-></span><span class="token function">date</span><span class="token punctuation">(</span><span class="token string single-quoted-string">'column_name'</span><span class="token punctuation">,</span> <span class="token string single-quoted-string">'placeholder...'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div></div></template>


